<?php

class AdodbRecordSet extends RecordSet {
    
    /**
     * @var      ADORecordSet
     */
    protected $rs;
    protected $_sql;
    
    public function __construct($rs, $sql) {
        $this->rs = $rs;
        $this->_sql = $sql;
    }
    
    /**
     * @param    int $style    
     * @return   array
     */
    public function fetch($style = null) {
        if (empty($this->rs)) {
            return false;
        }
        return $this->rs->FetchRow();
    }
    
    /**
     * @param    int $style    
     * @return   array
     */
    public function fetchAll($style = null) {
        return $this->rs->GetAll();
    }
    
    public function fetchColumn($column_number = 0) {
        if (empty($this->rs)) {
            return false;
        }
        $row = $this->fetch();
        return $row[$column_number];
    }
    
    /**
     * @return   int
     */
    public function rowCount() {
        return $this->rs->RowCount();
    }
    
    /**
     * @return   int
     */
    public function columnCount() {
        return $this->rs->FieldCount();
    }
    
    /**
     * @return   boolean
     */
    public function free() {
        return $this->rs->Close();
    }
}

?>